package agents;

import game.constants.ReferenceAgent;
import game.constants.ReferenceSpecialFeature;
import interfaces.impl.Agent;
import objects.SpetialFeature;
import objects.WorldObject;
import universe.Universe;
import actions.ActionDie;

public class AgentDie extends Agent{
	
	ActionDie actionDie;
	
	SpetialFeature currentLife;
	SpetialFeature totalLife;
	
	@Override
	public void initializeActionList() {
		actionDie=new ActionDie();
		addAction(actionDie);
		
	}

	@Override
	public void initializeSpecialFeatures() {
		currentLife=new SpetialFeature(ReferenceSpecialFeature.SPETIAL_FEATURE_CURRENT_LIFE);
		totalLife = new SpetialFeature(ReferenceSpecialFeature.SPETIAL_FEATURE_LIFE);
		
		addSpetialFeature(currentLife);
		addSpetialFeature(totalLife);
		
	}

	@Override
	public void initializeName() {
		name="Agent die";
		
	}

	@Override
	public void initializeId() {
		this.id=ReferenceAgent.AGENT_DIE;
		
	}

	@Override
	public void updateChild(WorldObject object, Universe universe, double time) {
		
		if(currentLife.getValue()<=0){
			actionDie.setSource(object);
			actionDie.setTarget(object);
			universe.setAction(actionDie);
		}
		
	}
	
	

}
